#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface YHAudioUnitManager : NSObject

#define SharedAUManager [YHAudioUnitManager sharedManager]

+ (instancetype)sharedManager;

/// 变声类型0：无，1：萝莉  2：大叔
@property (nonatomic, assign) NSInteger soundStretch;

/// 降噪等级 0：无，1:6dB  2:10dB   3:15dB
@property (nonatomic, assign) NSInteger suppression;

/// 录音状态
@property (assign, nonatomic, readonly) BOOL isRecording;

/// 播放状态
@property (assign, nonatomic, readonly) BOOL isPlaying;

/// 录音缩放等级
@property (nonatomic, assign) int recordFactor;

/// 音频采样率
@property (nonatomic, assign) int sampleRate;

/// 是否开启回声消除
@property (nonatomic, assign) BOOL echoCancellationEnabled;

/// 录音回调
@property (nonatomic, copy, nullable) void(^recordBufferCallback)(NSData *data);


/// 音量大小回调
@property (nonatomic, copy, nullable) void(^ampArrayCallback)(NSArray<NSNumber *> *ampArray);

@property (nonatomic, copy, nullable) void(^ampCallback)(NSInteger amp);

/// 开启、关闭音频单元
/// - Parameter flag: 开关标识
- (void)startAudioUnit:(BOOL)flag;

/// 开启、关闭录音
/// - Parameter flag: 开关标识
- (void)startRecord:(BOOL)flag;

/// 开启、关闭播放器
/// - Parameter flag: 开关标识
- (void)startPlay:(BOOL)flag;


/// 播放pcm实时流
/// - Parameter data: pcm数据
- (void)playWithPCM:(NSData *)pcm;

/// 设备实时播放的音频会话环境
- (void)setLiveAudioSession;

/// 设置默认的音频会话环境
- (void)setDefaultAudioSession;

/// 设置播放器状态的音频会话环境
- (void)setPlayingAudioSession;


@end
NS_ASSUME_NONNULL_END
